<?php

class Core_Frontend_Share_Component_Controller_Result_Page extends Dcmp_Component_Result_Base {

    private $_pageTemplate = NULL;
    private $_fileName = '';

    public function getFileName() {
        return $this->_fileName;
    }

    public function setFileName($value) {
        $this->_fileName = $value;
        return $this;
    }

    public function getPageTemplate() {
        return $this->_pageTemplate;
    }

    public function setPageTemplate($value) {
        $this->_pageTemplate = $value;
        return $this;
    }

    public function execute() {
        $domain = $this->getComponent()->getDomain();
        $template = new Dcmp_Template($domain);
        $template->assignMulti($this->getAllData());
        $fileName = $this->getFileName();
        if (empty($fileName)) {
            $fileName = Kd_Web::getRouter()->getAction();
        }
        $content = $template->render(DP_DESIGN .
                        strtolower($domain->getName()) .DS.$domain->getConfig()->getSetting('themeName').
                        Kd_Web::getSession()->get('website_theme') . DS .
                        'template' . DS .
                        $this->getPageTemplate()->getPageTheme()->getType() . DS .
                        $this->getPageTemplate()->getPageTheme()->getName() . DS .
                        str_replace('_', DS, $fileName) . '.phtml');
        Kd_Web::getResponse()->write($content);
    }

}